package com.dabai.iot.core.dto;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 设备输入实体类
 *
 * @author kev1n
 */
@Data
public class DeviceInput implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 产品Id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "产品Id")
    @NotNull
    private Long productId;

    /**
     * 设备名称
     */
    @Schema(description = "设备名称")
    @NotBlank(message = "设备名称不能为空")
    @Size(min = 1, max = 64, message = "设备名称长度必须在1-64之间")
    private String deviceName;

    /**
     * 设备序列号
     */
    @Schema(description = "设备序列号")
    @NotBlank
    private String deviceSn;

    /**
     * 设备描述
     */
    @Schema(description = "设备描述")
    @Size(max = 256, message = "设备描述长度不超过256个字符")
    private String deviceDesc;

    /**
     * 纬度
     */
    @Schema(description = "纬度")
    private BigDecimal latitude;

    /**
     * 经度
     */
    @Schema(description = "经度")
    private BigDecimal longitude;

    /**
     * 设备地址
     */
    @Schema(description = "设备地址")
    private String address;

}
